﻿<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <!-- layui.css -->
    <script th:src="@{/js/jquery-2.2.4.min.js}"></script>
    <script th:src="@{/js/workutil.js}"></script>
    <link th:href="@{/plugin/layui/css/layui.css}" rel="stylesheet"/>
    <link th:href="@{/css/layui_custom.css}" rel="stylesheet"/>
</head>
<body>
<from class="layui-form layui-form-pane" action="">
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">内容</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入内容" lay-verify="required" name="content" class="layui-textarea"></textarea>
        </div>
    </div>

    <div class="layui-form-item" style="text-align: center;">
        <button class="layui-btn" lay-submit="" lay-filter="broadcast">确认发送</button>
    </div>
</from>
<!-- layui.js -->
<script th:src="@{/plugin/layui/layui.js}"></script>
<!-- layui规范化用法 -->
<script type="text/javascript">
    layui.define(['layer', 'form'], function (exports) {
        var form = layui.form;
        var $ = layui.jquery;

        form.on('submit(broadcast)', function (data) {
            var index = layer.load(1);
            setTimeout(function () {
                workUtils.ajaxPost("../notice/add",data.field,function () {
                    layer.close(index);
                    $("[name='content']").val("");
                    layer.msg('系统通知已发送成功......', {time: 1500});
                });
            }, 400);
            return false;
        });
    });
</script>
</body>
</html>